<template>
  <div>
    <div class="fwzx">
      <div class="flex head align-center fs14">
        <div class="item1">日期</div>
        <div class="item2">标题</div>
        <div class="item3">操作</div>
      </div>
      <div class="body mt10">
        <div class="flex align-center" v-for="item in list" :key="item.noticeId">
          <div class="item1">{{ item.createTime }}</div>
          <div class="item2 text-overflow">{{ item.noticeTitle }}</div>
          <div class="item3">
            <el-button size="small" type="text" @click="handleInfo(item.noticeContent)">查看</el-button>
          </div>
        </div>
      </div>
    </div>
    <help-dialog title="服务动态" :visible.sync="dialogVisible" append-to-body>
      <editor v-model="noticeContent" read-only :min-height="192" />
    </help-dialog>
  </div>
</template>

<script>
import indexApi from '@/api/agriculture'

export default {
  data() {
    return {
      list: [],
      noticeContent: '',
      dialogVisible: false
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      indexApi.listNotice().then((res) => {
        this.list = res.rows
      })
    },
    handleInfo(noticeContent) {
      this.noticeContent = noticeContent
      this.dialogVisible = true
    }
  }
}
</script>

<style lang="scss" scoped>
.fwzx {
  height: 213px;
  .head {
    color: #03a9f4;
  }
  .item1 {
    width: 20%;
  }
  .item2 {
    width: 60%;
  }
  .item3 {
    width: 20%;
  }
  .body {
    overflow-y: auto;
    height: 180px;
  }
}
</style>
